#! /usr/bin/env node

const fs = require('fs');

// let argvs = process.argv.slice(2);

// let oldPath = argvs[0].slice(1);

// let newPath = argvs[1].slice(1);

// fs.renameSync(oldPath,newPath);  //重命名

let list = fs.readdirSync('./');

console.log(list)

let ind = 0;

list.forEach((item,index) => {
    if(/\.txt$/.test(item)){
        //判断是否是txt结尾的
        fs.renameSync(item,`index${ind+1}.js`);
        ind++;
    }
})

